package com.hzqy.service.hotel;

import com.hzqy.commons.utils.JsonUtils;
import com.hzqy.persistence.dao.hotel.HotelCouponDao;
import com.hzqy.persistence.dao.hotel.HotelYJFDao;
import com.hzqy.persistence.dao.picture.PictureDao;
import com.hzqy.service.core.GenericServiceBean;
import com.hzqy.web.vo.CmPicturesVo;
import com.hzqy.web.vo.HotelCouponCodeVo;
import com.hzqy.web.vo.HotelCouponVo;
import com.hzqy.web.vo.MonthlyOperationAnalysisAataVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class HotelYJFServiceBean extends GenericServiceBean<MonthlyOperationAnalysisAataVo, HotelYJFDao, Integer>{
    protected final Logger LOG = LoggerFactory.getLogger(getClass());

    @Resource
    private HotelYJFDao hotelYJFDao;

    @Override
    public HotelYJFDao getEntityDao() {
        return hotelYJFDao;
    }

    public Map<String, Object> hotelYJFList(MonthlyOperationAnalysisAataVo monthlyOperationAnalysisAataVo, int curPage, int pageSize) {
        Map<String, Object> map = new HashMap<>();
        int rows = hotelYJFDao.selectHotelYJFCount(monthlyOperationAnalysisAataVo);
        map.put("total", rows);
        map.put("f_moad_date", monthlyOperationAnalysisAataVo.getF_moad_date());
        map.put("f_moad_table_type", monthlyOperationAnalysisAataVo.getF_moad_table_type());
        map.put("f_moad_data_type", monthlyOperationAnalysisAataVo.getF_moad_data_type());
        map.put("firstResult", (curPage-1)*pageSize);
        map.put("maxResults", pageSize);

        List<MonthlyOperationAnalysisAataVo> results = hotelYJFDao.selectHotelYJFList(map);
        map.put("rows", results);
        return map;
    }

    public int insertYJF(MonthlyOperationAnalysisAataVo monthlyOperationAnalysisAataVo){
        return hotelYJFDao.insertYJF(monthlyOperationAnalysisAataVo);
    }


    public int deleteYJF(MonthlyOperationAnalysisAataVo monthlyOperationAnalysisAataVo){
        return hotelYJFDao.deleteYJF(monthlyOperationAnalysisAataVo);
    }

}
